library('ggplot2')

data1 <- c(33.48, 42.53, 48.53, 30.21, 38.76, 38.59, 52.93, 32.65, 52.42, 22.22, 41.4, 16.28, 40.83, 24.43, 56.38)

data2 <- c(112, 94, 118, 87, 96, 106, 71, 91, 95, 94, 100, 98, 94, 113, 85)

data3 <- c(12, 14, 18, 10, 13, 22, 17, 15, 16, 9, 19, 8, 20, 11, 21)

data4 <- c(2.2, 3.2, 3.4, 1.8, 2.8, 0.2, 4.4, 1.0, 4.6, 0.4, 1.6, 0.0, 1.2, 0.6, 4.2)

par(mfrow=c(2,2))

data <- data.frame(
  suc = data1,
  iq = data2,
  year_scholl= data3,
  grit = data4
)

# boxplot(data, main='Box plot of normal distribution', xlab='Group', ylab='value',
#         col = c("blue","red", "green", "black"),
#         names = c("success", "iq", "Years in school", "grit")
#         )

boxplot(
  data['suc'], main="success", col='blue', names='success',xlab='suc'
)

boxplot(
  data['iq'], main='iq', col='red', names='iq', xlab='iq'
)

boxplot(
  data['year_scholl'], main='school', col='green', names='school', xlab='school'
)

boxplot(
  data['grit'], main='grit', col='yellow', names='grit', xlab='grit'
)

# plot(data['iq'], data['suc'], main ='success vs. iq', xlab='iq', ylab='suc', col='blue')

# plot(data['year_scholl'], data['suc'], main='success vs. years school', xlab='school', ylab='suc', pch=19, col='red')
# 
# plot(data['grit'], data['suc'], main = 'success vs. grit', xlab='grit', ylab='suc', pch=19, col='yellow')

# ggplot(dat=data, aes(x=iq, y=suc)) +
#   geom_point(color='blue',size=3) +
#   geom_smooth(method='lm', color='blue') +
#   labs(title = 'success vs. iq', x='iq', y='success') +
#   theme_minimal()

par(mfrow=c(1,1))


